/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sim.BL;

import sim.DAL.UserLogin;
import sim.DAL.UserProfile;
/**
 *
 * @author rafik
 */
public class Login implements java.io.Serializable {

//    public UserLogin getUser(String username){
//        return new UserLogin(username);
//    }

    public static Boolean ValidateCredentials (String username, String password){
        Boolean exist = false;
        try {
        UserLogin login = new UserLogin(username);

        if (login != null && login.getPassword().equals(password)) {
            exist = true;
        }
        } catch (Exception exp) {
            return false;
        }
        return exist;
    }

    // fonction qui retourn le profile
    public UserProfile afficheProfile (String username){
       UserLogin login = new UserLogin(username);
       UserProfile UProfile = new UserProfile (login.getProfileId());
       return UProfile;
    }

    //fonction qui retourn profile_id
    public int getProfileId(String username, String password){
         UserLogin login = new UserLogin(username);
         return login.getProfileId();

    }
}